<?php
Box::$description["Matrix"] = "Display boxs in a matrix";
/**
*Draw a matrix of images.
*@author Willy Gardiol <willy@gardiol.org>
*@version 1.0
*@package Boxes
*@subpackage Matrix
*/
class Box_Matrix extends Box
{	
	public function __construct( $title  )
	{
		parent::__construct( $title, "inline", "box:Matrix/BoxMatrix" );
		$this->SetStorage(array("cols" => 0,
							"rows" => 0) );
	}
	protected function CollectData()
	{
		$this->AddControl( "Box_Matrix_edit", I18N("Configure Matrix") );

		$cols = $this->Get("cols");
		$rows = $this->Get("rows");
		$items = array();
		for ( $r = 0; $r < $rows; $r++ )
			for ( $c = 0; $c < $cols; $c++ )
				if ( $box = $this->GetChild( "-R-$r-C-$c" ) )
					$items[$r][$c] = $box;
				else
					$items[$r][$c] = false;

		return array("rows" => $rows,
					"cols" => $cols,
					"items" => $items
					);
	}
}
?>